from flask import Blueprint, current_app, request
from flask import jsonify
from flask_bcrypt import generate_password_hash, check_password_hash
from flask_restful import Resource
from flask_jwt_extended import jwt_required, get_jwt_identity
import datetime
import sqlite3
from . import api_rest


class PersonInfo(Resource):
    @jwt_required
    def get(self, username):
        conn = sqlite3.connect('backend/outbreak-management-system.db')
        c = conn.cursor()
        
        # 查询adminid
        order = "select * from PROPRIETOR where USERNAME='" + username +"'"
        print(order)
        c.execute(order)
        cursor = c.fetchall()
        print(cursor)
        conn.close()
        return jsonify({'properietor':cursor})

api_rest.add_resource(PersonInfo, '/personinfo/<username>')